Skip to content

fix: add missing PermissionDeniedError to litellm exceptions list#4832

Open
paipeline wants to merge 1 commit intoAider-AI:mainfrom
paipeline:fix/add-permission-denied-error
Open

fix: add missing PermissionDeniedError to litellm exceptions list#4832
paipeline wants to merge 1 commit intoAider-AI:mainfrom
paipeline:fix/add-permission-denied-error

Conversation

@paipeline
Copy link

Problem

LiteLLMExceptions.__init__() crashes with a ValueError when litellm includes exception classes not present in aider's EXCEPTIONS list:

ValueError: PermissionDeniedError is in litellm but not in aider's exceptions list

This is the same class of bug reported in #4829. The _load() method iterates dir(litellm) and raises ValueError for any *Error class that is a BaseException subclass but missing from aider's hardcoded list.

Fix

  • Added PermissionDeniedError to the EXCEPTIONS list as non-retryable (HTTP 403 — the user needs to fix their API key permissions, retrying won't help)
  • Added a descriptive message: "The API provider denied access. Check your API key permissions."
  • Added a test for the new exception

Testing

All 7 tests in tests/basic/test_exceptions.py pass, including the new test_permission_denied_error test.

Fixes #4829

Fixes Aider-AI#4829

litellm added PermissionDeniedError which was not in aider's EXCEPTIONS
list, causing a ValueError crash during LiteLLMExceptions initialization:

  ValueError: PermissionDeniedError is in litellm but not in aider's
  exceptions list

This is the same class of bug reported in Aider-AI#4829 (where BadGatewayError
was missing in an older version). The root cause is that aider's
exception list must be kept in sync with litellm's exception classes.

Added PermissionDeniedError as non-retryable with a descriptive message,
and added a corresponding test.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught ValueError in exceptions.py line 66

3 participants